import React, { Component } from 'react'
import Tab from "../../component/tab"
import Tou from "../../component/tou"
import List from "../../component/list"
import axios from 'axios'
export class Homepage extends Component {
  constructor(props) {
    super(props)
  
    this.state = {
       list:[],
       i:0,
    }
  }
  componentDidMount() { 
    axios.get("/list").then((res)=>{
        this.setState({
          list:res.data
        })
    })
    
   }

   tab(index){
     this.setState({
       i:index
     })


   }
  render() {
    const {list,i}=this.state
    return (
      <div>
    
        <Tab list={list}  i={i} tab={this.tab.bind(this)}></Tab>
        <Tou list={list} i={i}></Tou>
        <List list={list} i={i}></List>
 


      
      </div>
    )
  }
}

export default Homepage